#include <iostream>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <set>
#include <unordered_set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int n,k,x;
		cin>>n>>k>>x;
		if(x!=1)
		{
			cout<<"YES"<<endl;
			cout<<n<<endl;
			for(int i=0;i<n;i++) cout<<1<<' ';
			cout<<endl;
		}
		else
		{
			if(k==1){
				cout<<"NO"<<endl;
			}
			else
			{
				if(k==2 && n%2)
				{
					cout<<"NO"<<endl;
				}
				else
				{
					if(n%2)
					{
						cout<<"YES"<<endl;
						int num=n/2-1;
						cout<<n/2<<endl;
						for(int i=0;i<num;i++)
						{
							cout<<2<<' ';
						}
						cout<<3<<endl;
					}
					else
					{
						cout<<"YES"<<endl;
						cout<<n/2<<endl;
						for(int i=0;i<n/2;i++)
						{
							cout<<2<<' ';
						}
						cout<<endl;
					}
				}
			}
		}
	}

	return 0;
}

